package com.un10.qianduan.contorller;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.un10.entity.Proclass;
import com.un10.entity.Product;
import com.un10.service.ProclassService;
import com.un10.service.ProductService;

@Controller
public class productdetailWebContorller {
	@Autowired
	ProclassService proclassService;
	// 商品
	@Autowired
	ProductService productService;

	@RequestMapping("/B/productdetail")
	public String pro(Model model, HttpSession session) {
		// 商品分类
		List<Proclass> proclass = proclassService.findAllProclass(0, 9999, null);
		model.addAttribute("proclass", proclass);
		// 重定向到主页面的跳转方法
//    System.out.println(proclass);]productdetail

		return "B/product-detail";

	}

	@RequestMapping("/B/ProductCate")
	public String ProductCate(Model model, @RequestParam("proName") String proName) {
		List<Product> productCateAll = productService.findProductxiangqing(proName);
		
		model.addAttribute("CateProAll", productCateAll);
	
		// 重定向到主页面的跳转方法
		return "B/product-detail";
	}

}
